package com.rd.student.ruanjian.class3.gaochenxi.LianXi1.FactoryClass;

public class OutputFactory {
    public outPut getOutput(){
        return new Printer();//得到的时Printer的对象
    }

    public static void main(String[] args) {
        OutputFactory outputFactory=new OutputFactory();
        Computer com=new Computer(outputFactory.getOutput());//outputFactory.getOutput()返回的Printer的对象，此时就像是com=new Printer();
        com.print();//此时调用的是类Printer中的重写方法: print();
    }
}
